package cn.edu.hqu.cst.crj.layoutdemo;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.content.Intent;
import android.view.View;

public class Linear extends AppCompatActivity implements View.OnClickListener{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_linear);
        //水平布局
        findViewById(R.id.btn_level_layout).setOnClickListener(this);
        //垂直布局
        findViewById(R.id.btn_vertical_layout).setOnClickListener(this);
        //靠左对齐
        findViewById(R.id.btn_left_layout).setOnClickListener(this);
        //返回
        findViewById(R.id.btn_back).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        Intent intent=new Intent();
        switch (v.getId()) {
            case R.id.btn_level_layout:
                intent.setClass(Linear.this, LinearLevel.class);
                startActivity(intent);
                break;
            case R.id.btn_vertical_layout:
                intent.setClass(Linear.this, LinearVertical.class);
                startActivity(intent);
                break;
            case R.id.btn_left_layout:
                intent.setClass(Linear.this, LinearLeft.class);
                startActivity(intent);
                break;


            case R.id.btn_back:
                finish();
        }
        //startActivity(intent);

    }
}
